# -*- mode: python -*-

block_cipher = None


a = Analysis(['../app.py'],
             pathex=['./'],
             binaries=None,
             datas=None,
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

def extra_datas(mydir):
    if mydir.endswith('/'):
        mydir = mydir[:-1]
    import os
    import glob
    def rec_glob(p, files):

        for d in glob.glob(p):
            if os.path.isfile(d):
                files.append(d)
            rec_glob("%s/*" % d, files)

    files = []
    rec_glob("%s/*" % mydir, files)
    extra_datas = []
    for f in files:
        d_path = '/'.join(mydir.split('/')[:-1])
        r_path = f[len(d_path)+1:]
        extra_datas.append((r_path, f, 'DATA'))

    return extra_datas

a.datas += extra_datas('../libs')


exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name='app',
          debug=False,
          strip=False,
          upx=True,
          console=False )

app = BUNDLE(exe,
             name='app.app',
             icon='../libs/img/zhusun.icns',
             bundle_identifier=None)